<?php require '../public/system/headers/headers.php';?>
<?php $this->headScript()->appendFile($this->websiteUrl .'system/js/jquery/jquery.js'); ?>
<?php $this->headScript()->appendFile($this->websiteUrl .'system/js/php.js'); ?>
<?php echo $this->headScript(); ?>
<!--?php echo $this->headLink()->appendStylesheet($this->websiteUrl . 'system/css/seotoaster.css'); ?-->
<div id="seotoaster" class="cartview">
	<div id="startmsg" class="success" style="display: none;">
		Updating your cart. Please wait...
	</div>
	<div id="companyinfo">
		<img src="<?php echo str_replace('/small/', '/original/',$this->logoPath . $this->companyLogoName); ?>" alt="<?php echo $this->companyName; ?>" />
		<div>
			<?php echo $this->companyName; ?><br />
			<?php echo $this->companyAddress; ?><br />
			<span id="company-phone"><?php echo $this->companyPhone; ?></span>
			<!--span id="company-email"><?php echo $this->companyEmail; ?></span-->
		</div>
		<h1 style="text-align:center;position:absolute;bottom:5px;right:15px;">{%Shopping cart overview%}</h1>
	</div>

	<div id="cartview-toplegend">
		<div style="width:28%;">{%Photo%}</div>
		<div style="width:40%;">{%Description%}</div>
		<div style="width:10%;">{%Amount%}</div>
		<div style="width:10%;">{%Price%}</div>
		<div style="width:10%;">{%Remove%}</div>
	</div>
    <?php $paypalDescriptionProducts= ''; $paypalItemIdProducts = ''; ?>

		<form action="javascript:;" id="cartview-itemsholder">
			<?php foreach($this->products as $key => $product): ?>
			  <div class="productitem" id="item-<?php echo $product['id'] . '-' . $key; ?>">
					<div class="item-photo" style="width:28%;"><img src="<?php echo $this->websiteUrl . $product['photo']; ?>" alt="<?php echo $product['name']; ?>"/></div>
					<div class="item-name" style="width:40%;text-align:left;"><?php echo substr($product['name'],0,50); ?>
						<?php if(isset($product['options'])): ?>
							<?php foreach($product['options'] as $optKey => $optionsData): ?>
								<?php if($optionsData != 'select ' . $optKey): echo $optKey . ': ' . $optionsData; endif;?>
								<input class="<?php echo $product['id'] . '-' . $key; ?>" type="hidden" value="<?php echo $optKey . '=' . $optionsData; ?>" />
							<?php endforeach; ?>
						<?php endif; ?>
					</div>
					<div class="item-count" style="width:10%;"><input  onchange="//javascript: recountOrder();" name="itemsCount[<?php echo $product['id'] ?>]" type="text" id="itmcount-<?php echo $product['id'] . '-' . $key; ?>" value="<?php echo $product['count']; ?>" /></div>
					<div class="item-price" style="width:10%;font-weight:bold;"><?php echo $product['price']; ?></div>
					<div class="item-delchck" style="width:10%;"><input type="checkbox" id="todelete-<?php echo $product['id'] . '-' . $key; ?>"/></div>
				</div> <?php $paypalDescriptionProducts .= $product['name'].'('.$product['itemId'].', '.$product['count'].'), '; $paypalItemIdProducts .= $product['itemId'].','; ?>
			<?php endforeach; ?>
		</form>
    <?php $paypalDescriptionProducts = rtrim($paypalDescriptionProducts, ', '); $paypalItemIdProducts = rtrim($paypalItemIdProducts, ','); ?>
    <div id="totalprice">
    	<button class="formsubmit" id="keepshopping" onclick="history.go(-1);" style="float:left;">{%Keep shopping%}</button>
        <?php if ($this->total > 0) : ?><button class="formsubmit" id="checkout" onclick="$('.cart-pay').show('slow');" style="float:left;margin-left:30px;">{%Checkout%}</button>
        <button class="formsubmit" id="recount" onclick="recountOrder();"  style="float:left;margin-left:30px;">{%Update cart%}</button><?php endif; ?>
		<div><span>{%Total%}:</span>&nbsp;<span><?php echo ($this->total) ? $this->total . ' ' . $this->currency  : '{%There are no items in your cart.%}'; ?></span></div>
    </div>

    <div class="cart-pay">
        <div class="cart-pay-title">{%Pay with PayPal%}:</div>
        <div id="cart-paypal-account"><span>+</span> {%Account%}</div>
        <div id="cart-settings-paypal-account" class="cart-settings">
            <form action="https://www.paypal.com/cgi-bin/webscr" target="_blank" method="post">
                <input type="hidden" name="cmd" value="_xclick">
                <input type="hidden" name="business" value="<?php echo $this->settingsPayPal['email']; ?>">
                <input type="hidden" name="lc" value="US">
                <input type="hidden" name="item_name" value="<?php echo $paypalDescriptionProducts; ?>">
                <input type="hidden" name="item_number" value="<?php echo $paypalItemIdProducts; ?>">
                <input type="hidden" name="amount" value="<?php echo $this->total; ?>">
                <input type="hidden" name="tax" value="<?php echo (is_numeric($this->config['tax']) ? $this->config['tax'] : '0.00'); ?>">
                <input type="hidden" name="currency_code" value="<?php echo $this->config['currency']; ?>">
                <input type="hidden" name="button_subtype" value="products">
                <input type="hidden" name="notify_url" value="<?php echo $this->websiteUrl; ?>sys/backend_shopping/handlerpaypalaccount/">
                <input type="hidden" name="rm"  value="2">
                <input type="hidden" name="cancel_return" value="<?php echo $this->websiteUrl; ?>cart">
                <input type="hidden" name="bn" value="PP-BuyNowBF:btn_paynow_LG.gif:NonHostedGuest">
				<input type="image" src="<?php echo $this->websiteUrl; ?>system/images/btn_paynow_LG.gif" border="0" name="submit" alt="PayPal" style="padding:0;border:0;">
             </form>
        </div>
        
        <div id="cart-credit-card"><span>+</span> {%Credit Cart%}</div>
        <div id="cart-settings-credit-card" class="cart-settings">
            <form action="javascript:;" name="paypal-creditcard" id="paypal-creditcard">
                <div style="width: 350px;">
                <p><label>{%First Name%}:</label> <input type="text" name="credit-card-firstname" id="credit-card-firstname"></p>
                <p><label>{%Last Name%}:</label> <input type="text" name="credit-card-lastname" id="credit-card-lastname"></p>
                <p><label>{%Payment Type%}:</label>
                    <select name="credit-card-type" id="credit-card-type">
                        <option value="Visa" selected="selected">Visa</option>
                        <option value="MasterCard">MasterCard</option>
                        <option value="Discover">Discover</option>
                        <option value="Amex">American Express</option>
                    </select>
                </p>
                <p><label>{%Credit Card Number%}:</label> <input type="text" name="credit-card-cardnumber" id="credit-card-cardnumber"></p>
                <p><label>{%Card Verification Number%}:</label> <input type="text" name="credit-card-verification-number" id="credit-card-verification-number"></p>
                <p><label>{%Expiration Date%}:</label>
                    <select name="credit-card-expiration-date-year" id="credit-card-expiration-date-year" style="width:100px;margin-left:5px;">
                        <?php $currentYear = date('Y'); ?>
                        <?php for ($y=$currentYear; $y<=$currentYear+10; $y++): ?>
                        <option value="<?php echo $y; ?>"><?php echo $y; ?></option>
                        <?php endfor; ?>
                    </select>
                       <select name="credit-card-expiration-date-month" id="credit-card-expiration-date-month" style="width:50px;">
                        <?php for ($m=1; $m<=12; $m++) : ?>
                        <option value="<?php echo $m; ?>"><?php echo $m; ?></option>
                        <?php endfor; ?>
                    </select>
                </p>
                <p><label>{%Billing Address%} 1:</label> <input type="text" name="credit-card-billing-address1" id="credit-card-billing-address1"></p>
                <p><label>{%Billing Address%} 2:</label> <input type="text" name="credit-card-billing-address2" id="credit-card-billing-address2"></p>
                <p><label>{%City%}:</label> <input type="text" name="credit-card-city" id="credit-card-city"></p>
                <p><label>{%Country%}:</label>
                    <select id="credit-card-country" name="credit-card-country">
                        <option value=""></option>
                        <option value="US" selected="selected">United States</option>
                        <option value="AL">Albania</option>
                        <option value="DZ">Algeria</option>
                        <option value="AD">Andorra</option>
                        <option value="AO">Angola</option>
                        <option value="AI">Anguilla</option>
                        <option value="AG">Antigua and Barbuda</option>
                        <option value="AR">Argentina</option>
                        <option value="AM">Armenia</option>
                        <option value="AW">Aruba</option>
                        <option value="AU">Australia</option>
                        <option value="AT">Austria</option>
                        <option value="AZ">Azerbaijan Republic</option>
                        <option value="BS">Bahamas</option>
                        <option value="BH">Bahrain</option>
                        <option value="BB">Barbados</option>
                        <option value="BE">Belgium</option>
                        <option value="BZ">Belize</option>
                        <option value="BJ">Benin</option>
                        <option value="BM">Bermuda</option>
                        <option value="BT">Bhutan</option>
                        <option value="BO">Bolivia</option>
                        <option value="BA">Bosnia and Herzegovina</option>
                        <option value="BW">Botswana</option>
                        <option value="BR">Brazil</option>
                        <option value="VG">British Virgin Islands</option>
                        <option value="BN">Brunei</option>
                        <option value="BG">Bulgaria</option>
                        <option value="BF">Burkina Faso</option>
                        <option value="BI">Burundi</option>
                        <option value="KH">Cambodia</option>
                        <option value="CA">Canada</option>
                        <option value="CV">Cape Verde</option>
                        <option value="KY">Cayman Islands</option>
                        <option value="TD">Chad</option>
                        <option value="CL">Chile</option>
                        <option value="C2">China</option>
                        <option value="CO">Colombia</option>
                        <option value="KM">Comoros</option>
                        <option value="CK">Cook Islands</option>
                        <option value="CR">Costa Rica</option>
                        <option value="HR">Croatia</option>
                        <option value="CY">Cyprus</option>
                        <option value="CZ">Czech Republic</option>
                        <option value="CD">Democratic Republic of the Congo</option>
                        <option value="DK">Denmark</option>
                        <option value="DJ">Djibouti</option>
                        <option value="DM">Dominica</option>
                        <option value="DO">Dominican Republic</option>
                        <option value="EC">Ecuador</option>
                        <option value="SV">El Salvador</option>
                        <option value="ER">Eritrea</option>
                        <option value="EE">Estonia</option>
                        <option value="ET">Ethiopia</option>
                        <option value="FK">Falkland Islands</option>
                        <option value="FO">Faroe Islands</option>
                        <option value="FM">Federated States of Micronesia</option>
                        <option value="FJ">Fiji</option>
                        <option value="FI">Finland</option>
                        <option value="FR">France</option>
                        <option value="GF">French Guiana</option>
                        <option value="PF">French Polynesia</option>
                        <option value="GA">Gabon Republic</option>
                        <option value="GM">Gambia</option>
                        <option value="DE">Germany</option>
                        <option value="GI">Gibraltar</option>
                        <option value="GR">Greece</option>
                        <option value="GL">Greenland</option>
                        <option value="GD">Grenada</option>
                        <option value="GP">Guadeloupe</option>
                        <option value="GT">Guatemala</option>
                        <option value="GN">Guinea</option>
                        <option value="GW">Guinea Bissau</option>
                        <option value="GY">Guyana</option>
                        <option value="HN">Honduras</option>
                        <option value="HK">Hong Kong</option>
                        <option value="HU">Hungary</option>
                        <option value="IS">Iceland</option>
                        <option value="IN">India</option>
                        <option value="ID">Indonesia</option>
                        <option value="IE">Ireland</option>
                        <option value="IL">Israel</option>
                        <option value="IT">Italy</option>
                        <option value="JM">Jamaica</option>
                        <option value="JP">Japan</option>
                        <option value="JO">Jordan</option>
                        <option value="KZ">Kazakhstan</option>
                        <option value="KE">Kenya</option>
                        <option value="KI">Kiribati</option>
                        <option value="KW">Kuwait</option>
                        <option value="KG">Kyrgyzstan</option>
                        <option value="LA">Laos</option>
                        <option value="LV">Latvia</option>
                        <option value="LS">Lesotho</option>
                        <option value="LI">Liechtenstein</option>
                        <option value="LT">Lithuania</option>
                        <option value="LU">Luxembourg</option>
                        <option value="MG">Madagascar</option>
                        <option value="MW">Malawi</option>
                        <option value="MY">Malaysia</option>
                        <option value="MV">Maldives</option>
                        <option value="ML">Mali</option>
                        <option value="MT">Malta</option>
                        <option value="MH">Marshall Islands</option>
                        <option value="MQ">Martinique</option>
                        <option value="MR">Mauritania</option>
                        <option value="MU">Mauritius</option>
                        <option value="YT">Mayotte</option>
                        <option value="MX">Mexico</option>
                        <option value="MN">Mongolia</option>
                        <option value="MS">Montserrat</option>
                        <option value="MA">Morocco</option>
                        <option value="MZ">Mozambique</option>
                        <option value="NA">Namibia</option>
                        <option value="NR">Nauru</option>
                        <option value="NP">Nepal</option>
                        <option value="NL">Netherlands</option>
                        <option value="AN">Netherlands Antilles</option>
                        <option value="NC">New Caledonia</option>
                        <option value="NZ">New Zealand</option>
                        <option value="NI">Nicaragua</option>
                        <option value="NE">Niger</option>
                        <option value="NU">Niue</option>
                        <option value="NF">Norfolk Island</option>
                        <option value="NO">Norway</option>
                        <option value="OM">Oman</option>
                        <option value="PW">Palau</option>
                        <option value="PA">Panama</option>
                        <option value="PG">Papua New Guinea</option>
                        <option value="PE">Peru</option>
                        <option value="PH">Philippines</option>
                        <option value="PN">Pitcairn Islands</option>
                        <option value="PL">Poland</option>
                        <option value="PT">Portugal</option>
                        <option value="QA">Qatar</option>
                        <option value="CG">Republic of the Congo</option>
                        <option value="RE">Reunion</option>
                        <option value="RO">Romania</option>
                        <option value="RU">Russia</option>
                        <option value="RW">Rwanda</option>
                        <option value="VC">Saint Vincent and the Grenadines</option>
                        <option value="WS">Samoa</option>
                        <option value="SM">San Marino</option>
                        <option value="ST">São Tomé and Príncipe</option>
                        <option value="SA">Saudi Arabia</option>
                        <option value="SN">Senegal</option>
                        <option value="SC">Seychelles</option>
                        <option value="SL">Sierra Leone</option>
                        <option value="SG">Singapore</option>
                        <option value="SK">Slovakia</option>
                        <option value="SI">Slovenia</option>
                        <option value="SB">Solomon Islands</option>
                        <option value="SO">Somalia</option>
                        <option value="ZA">South Africa</option>
                        <option value="KR">South Korea</option>
                        <option value="ES">Spain</option>
                        <option value="LK">Sri Lanka</option>
                        <option value="SH">St. Helena</option>
                        <option value="KN">St. Kitts and Nevis</option>
                        <option value="LC">St. Lucia</option>
                        <option value="PM">St. Pierre and Miquelon</option>
                        <option value="SR">Suriname</option>
                        <option value="SJ">Svalbard and Jan Mayen Islands</option>
                        <option value="SZ">Swaziland</option>
                        <option value="SE">Sweden</option>
                        <option value="CH">Switzerland</option>
                        <option value="TW">Taiwan</option>
                        <option value="TJ">Tajikistan</option>
                        <option value="TZ">Tanzania</option>
                        <option value="TH">Thailand</option>
                        <option value="TG">Togo</option>
                        <option value="TO">Tonga</option>
                        <option value="TT">Trinidad and Tobago</option>
                        <option value="TN">Tunisia</option>
                        <option value="TR">Turkey</option>
                        <option value="TM">Turkmenistan</option>
                        <option value="TC">Turks and Caicos Islands</option>
                        <option value="TV">Tuvalu</option>
                        <option value="UG">Uganda</option>
                        <option value="UA">Ukraine</option>
                        <option value="AE">United Arab Emirates</option>
                        <option value="GB">United Kingdom</option>
                        <option value="UY">Uruguay</option>
                        <option value="VU">Vanuatu</option>
                        <option value="VA">Vatican City State</option>
                        <option value="VE">Venezuela</option>
                        <option value="VN">Vietnam</option>
                        <option value="WF">Wallis and Futuna Islands</option>
                        <option value="YE">Yemen</option>
                        <option value="ZM">Zambia</option>
                    </select>
                </p>
                <p><label>{%State%}:</label>
                    <select id="credit-card-state" name="credit-card-state">
                        <option value=""></option>
                        <option value="AK">AK</option>
                        <option value="AL">AL</option>
                        <option value="AR">AR</option>
                        <option value="AZ">AZ</option>
                        <option value="CA">CA</option>
                        <option value="CO">CO</option>
                        <option value="CT">CT</option>
                        <option value="DC">DC</option>
                        <option value="DE">DE</option>
                        <option value="FL">FL</option>
                        <option value="GA">GA</option>
                        <option value="HI">HI</option>
                        <option value="IA">IA</option>
                        <option value="ID">ID</option>
                        <option value="IL">IL</option>
                        <option value="IN">IN</option>
                        <option value="KS">KS</option>
                        <option value="KY">KY</option>
                        <option value="LA">LA</option>
                        <option value="MA">MA</option>
                        <option value="MD">MD</option>
                        <option value="ME">ME</option>
                        <option value="MI">MI</option>
                        <option value="MN">MN</option>
                        <option value="MO">MO</option>
                        <option value="MS">MS</option>
                        <option value="MT">MT</option>
                        <option value="NC">NC</option>
                        <option value="ND">ND</option>
                        <option value="NE">NE</option>
                        <option value="NH">NH</option>
                        <option value="NJ">NJ</option>
                        <option value="NM">NM</option>
                        <option value="NV">NV</option>
                        <option value="NY">NY</option>
                        <option value="OH">OH</option>
                        <option value="OK">OK</option>
                        <option value="OR">OR</option>
                        <option value="PA">PA</option>
                        <option value="RI">RI</option>
                        <option value="SC">SC</option>
                        <option value="SD">SD</option>
                        <option value="TN">TN</option>
                        <option value="TX">TX</option>
                        <option value="UT">UT</option>
                        <option value="VA">VA</option>
                        <option value="VT">VT</option>
                        <option value="WA">WA</option>
                        <option value="WI">WI</option>
                        <option value="WV">WV</option>
                        <option value="WY">WY</option>
                        <option value="AA">AA</option>
                        <option value="AE">AE</option>
                        <option value="AP">AP</option>
                        <option value="AS">AS</option>
                        <option value="FM">FM</option>
                        <option value="GU">GU</option>
                        <option value="MH">MH</option>
                        <option value="MP">MP</option>
                        <option value="PR">PR</option>
                        <option value="PW">PW</option>
                        <option value="VI">VI</option>
                    </select>
                </p>
                <p><label>{%ZIP Code%}:</label><input type="text" name="credit-card-zip" id="credit-card-zip"></p>
                <p><label>{%Phone%}:</label><input type="text" name="credit-card-phone" id="credit-card-phone"></p>
                   <input type="hidden" name="credit-card-amt" id="credit-card-amt" value="<?php echo $this->total; ?>" />
                   <input type="hidden" name="credit-card-desc" id="credit-card-desc" value="<?php echo $paypalDescriptionProducts; ?>" />
                   <input type="hidden" name="credit-card-currency-code" id="credit-card-currency-code" value="<?php echo $this->config['currency']; ?>" />
                   <input type="hidden" name="credit-card-tax" id="credit-card-tax" value="<?php echo (is_numeric($this->config['tax']) ? $this->config['tax'] : '0.00'); ?>" />
                <p align="right"><input type="button" class="formsubmit" name="credit-card-paynow" id="credit-card-paynow" value="{%Pay Now%}" style="width:140px;" onclick="payCreditCart();"></p>
                </div>
            </form>
        </div>
        
        <div class="cart-pay-title">{%OR%}</div>

        <div id="cart-generate-quote"><span>+</span> {%Generate Quote%}</div>
        <div id="cart-settings-quote" class="cart-settings">
            <form action="javascript:;" name="form_quote" id="form_quote">
                <div style="width:350px;">
					<p><label>{%Name%}:*</label><input type="text" name="cart-quote-name" id="cart-quote-name"></p>
					<p><label>{%Email%}:*</label><input type="text" name="cart-quote-email" id="cart-quote-email"></p>
					<p><label>{%Country%}:</label><input type="text" name="cart-quote-country" id="cart-quote-country"></p>
					<p><label>{%State%}:</label><input type="text" name="cart-quote-state" id="cart-quote-state"></p>
					<p><label>{%City%}:</label><input type="text" name="cart-quote-city" id="cart-quote-city"></p>
					<p><label>{%Zip%}:</label><input type="text" name="cart-quote-zip" id="cart-quote-zip"></p>
					<p><label>{%Address%} 1:</label><input type="text" name="cart-quote-address1" id="cart-quote-address1"></p>
					<p><label>{%Address%} 2:</label><input type="text" name="cart-quote-address2" id="cart-quote-address2"></p>
					<p><label>{%Phone%}:</label><input type="text" name="cart-quote-phone" id="cart-quote-phone"></p>
					<p style="height:80px;"><label>{%Comments%}:</label><textarea name="cart-quote-comments" id="cart-quote-comments" cols="5" rows="3" style="width:200px;"></textarea></p>
					<p align="right"><input type="button" class="formsubmit" name="cart-quote-quoteme" id="cart-quote-quoteme" value="{%Quote Me%}" style="width:140px;" onclick="saveQuote();"></p>
                </div>
            </form>
        </div>
        <br />
    </div>

</div>

<script type="text/javascript">
    $('.productitem:odd').css('background', '#FFFFEE');
    document.getElementById('cart-paypal-account').addEventListener('click', function() {
        if (/[+]/g.test(this.childNodes.item(0).innerHTML)) {
            this.childNodes.item(0).innerHTML = '-';
            document.getElementById('cart-settings-paypal-account').style.display = 'block';
        } else {
            this.childNodes.item(0).innerHTML = '+';
            document.getElementById('cart-settings-paypal-account').style.display = 'none';
        }
    }, false);
     document.getElementById('cart-credit-card').addEventListener('click', function() {
        if (/[+]/g.test(this.childNodes.item(0).innerHTML)) {
            this.childNodes.item(0).innerHTML = '-';
            document.getElementById('cart-settings-credit-card').style.display = 'block';
        } else {
            this.childNodes.item(0).innerHTML = '+';
            document.getElementById('cart-settings-credit-card').style.display = 'none';
        }
    }, false);
     document.getElementById('cart-generate-quote').addEventListener('click', function(){
        if (/[+]/g.test(this.childNodes.item(0).innerHTML)) {
            this.childNodes.item(0).innerHTML = '-';
            document.getElementById('cart-settings-quote').style.display = 'block';
        } else {
            this.childNodes.item(0).innerHTML = '+';
            document.getElementById('cart-settings-quote').style.display = 'none';
        }
    }, false);
    
    function saveQuote()
    {
        var regEmail = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})$/;
        var name = $('#cart-quote-name').val();
        var email = $('#cart-quote-email').val();
        name = name.replace(/^\s+/g,''); name = name.replace(/\s+$/g,'');
        if(email == '' || !email.match(regEmail) || name == '') {
            return;
        }
        $.ajax({
            url : '<?php echo $this->websiteUrl; ?>sys/backend_shopping/quoteme/',
            type : 'post',
            dataType : 'json',
            data : {
                name : name,
                email : email,
                country : $('#cart-quote-country').val(),
                state : $('#cart-quote-state').val(),
                city : $('#cart-quote-city').val(),
                zip : $('#cart-quote-zip').val(),
                address1 : $('#cart-quote-address1').val(),
                address2 : $('#cart-quote-address2').val(),
                phone : $('#cart-quote-phone').val(),
                comments : $('#cart-quote-comments').val()
            },
            beforeSend : function() {
                $('#startmsg').html('Sending quote, please wait...');
                $('#startmsg').show();
            },
            complete : function() {
                window.setTimeout('$("#startmsg").hide(0, function(){$("#startmsg").html("Updating your cart. Please wait...");});', 3000);
            },
            success : function(result) {
                if (result.done) {
                    $('#startmsg').html('You qoute request was sent.');
                } else {
                    $('#startmsg').html('You qoute request is fail.');
                }
            }
        });
    }
    
    function payCreditCart()
    {
        $.ajax({
            url : '<?php echo $this->websiteUrl; ?>sys/backend_shopping/handlerpaypalcreditcard/',
            type : 'post',
            dataType : 'json',
            data : {
                firstname : $('#credit-card-firstname').val(),
                lastname : $('#credit-card-lastname').val(),
                type : $('#credit-card-type').val(),
                cardnumber : $('#credit-card-cardnumber').val(),
                verification_number : $('#credit-card-verification-number').val(),
                expiration_date_year : $('#credit-card-expiration-date-year').val(),
                expiration_date_month : $('#credit-card-expiration-date-month').val(),
                billing_address1 : $('#credit-card-billing-address1').val(),
                billing_address2 : $('#credit-card-billing-address2').val(),
                city : $('#credit-card-city').val(),
                country : $('#credit-card-country').val(),
                state : $('#credit-card-state').val(),
                zip : $('#credit-card-zip').val(),
                phone : $('#credit-card-phone').val(),
                amt : $('#credit-card-amt').val(),
                desc : $('#credit-card-desc').val(),
                currency_code : $('#credit-card-currency-code').val(),
                tax : $('#credit-card-tax').val()
            },
            beforeSend : function() {
                $('#startmsg').css('top', '70%');
                $('#startmsg').html('Process paying, please wait...');
                $('#startmsg').show();
            },
            complete : function() {
                window.setTimeout('$("#startmsg").hide(0, function() { $(this).css("top", "35%"); $(this).html("Updating your cart. Please wait...");});', 3000);
            },
            success : function(result) {
                if (result.done) {
                    $('#startmsg').html('You paid.');
                } else {
                    $('#startmsg').html('Your payment is fail. Please, check your data.');
                }
            }
        });
    }
</script>